package com.feihong.yw189.bluetooth.utils.util;



import android.app.AlertDialog.Builder;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface.OnCancelListener;


public class Common {
	///定义一个进度条对话框
	private static ProgressDialog progressBar; 
	private static Builder builder;
	

	//初始化进度条
	public static void progressbarInit(Context context, String title,String message)
	{
		progressBar = new ProgressDialog(context);
		progressBar.setMax(100);
		progressBar.incrementProgressBy(1);
		progressBar.setTitle(title);
		progressBar.setMessage(message);
		progressBar.setCancelable(false);
		progressBar.show();
	}
	
	public static void progressbarInit1(Context context, String title,String message,OnCancelListener listener)
	{
		progressBar = new ProgressDialog(context);
		progressBar.setMax(100);
		progressBar.incrementProgressBy(1);
		progressBar.setTitle(title);
		progressBar.setMessage(message);
		progressBar.setCancelable(true);
		progressBar.setCanceledOnTouchOutside(true);
		progressBar.setOnCancelListener(listener);
		progressBar.show();
	}
	
	public static void setProgressbarText(String message)
	{
		if(progressBar!=null)
			progressBar.setMessage(message);
	}
	
	
	public static void progressbarSetMessage(String message)
	{
		if(progressBar!=null)
		{
			progressBar.setMessage(message);
		}
	}
	
	//进度条销毁
	public static void progressbarEnd()
	{
		
		if(progressBar != null)
		{
			progressBar.dismiss();
			progressBar = null;
		}
	}
	
	//提示对话框初始化
	public static void dialogInit(Context context, String title,String message)
	{
		builder = new Builder(context);
		builder.setTitle(title);
		builder.setMessage(message);
		builder.create();
		builder.show();
	}
	
	
	 public static String getNation(byte nation)
	 {
		 switch (nation) {
			 case 01:return "汉族";
			 case 02:return "蒙族";
			 case 03:return "回族";
			 case 04:return "藏族";
			 case 05:return "维吾尔族";
			 case 06:return "苗族";
			 case 07:return "彝族";
			 case 8:return "壮族";
			 case 9:return "布依族";
			 case 10:return "朝鲜族";
			 case 11:return "满族";
			 case 12:return "侗族";
			 case 13:return "瑶族";

			 case 14:return "白族";
			 case 15:return "土家族";
			 case 16:return "哈尼族";
			 case 17:return "哈萨克族";
			 case 18:return "傣族";
			 case 19:return "黎族";
			 case 20:return "僳僳族";
			 case 21:return "佤族";
			 case 22:return "畲族";
			 case 23:return "高山族";
			 case 24:return "拉祜族";
			 case 25:return "东乡族";
			 case 26:return "苗族";
			 case 27:return "纳西族";
			 case 28:return "景颇族";
			 case 29:return "柯尔克孜族";
			 case 30:return "土族";
			 case 31:return "达斡尔族";
			 case 32:return "仫佬族";
			 case 33:return "羌族";
			 case 34:return "布朗族";
			 case 35:return "撒拉族";
			 case 36:return "毛难族";
			 case 37:return "仡佬族";
			 case 38:return "锡伯族";
			 case 39:return "阿昌族";
			 case 40:return "普米族";
			 case 41:return "塔吉克族";
			 case 42:return "怒族";
			 case 43:return "乌孜别克族";
			 case 44:return "俄罗斯族";
			 case 45:return "鄂温克族";
			 case 46:return "崩龙族";
			 case 47:return "保安族";
			 case 48:return "裕固族";
			 case 49:return "京族";
			 case 50:return "塔塔尔族";
			 case 51:return "独龙族";
			 case 52:return "鄂伦春族";
			 case 53:return "赫哲族";
			 case 54:return "门巴族";
			 case 55:return "珞巴族";
			 case 56:return "基诺族";
			 case 57:return "少数民族";
			 default:
				 break;
		 }
		 return "失败";
	 }
	
	 

}
